﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace LanDBom.Models.Procure
{
    public class Modlfy_Nda
    {
        LDbaseEntities LD = new LDbaseEntities();
        public Ndardo Getnda(string Fo_id)
        {
            Ndardo nda = LD.Ndardo.Where(x => x.Fo_id == Fo_id).FirstOrDefault();
            return nda;
        }

        public int ChangeNdardo(Ndardo nda)
        {
            Ndardo Nda = Getnda(nda.Fo_id.ToString());
            Nda.Fo_id = nda.Fo_id;
            Nda.Nd_wuLiao = nda.Nd_wuLiao;
            Nda.Nd_Gong = nda.Nd_Gong;
            Nda.Nd_jiage = nda.Nd_jiage;
            Nda.Nd_danwei = nda.Nd_danwei;

            return LD.SaveChanges();
        }

        public Formation Getfm(string Fo_id)
        {
            Formation nda = LD.Formation.SingleOrDefault(x => x.FM_name == Fo_id);

            return nda;
        }

        public int Changefm(Formation nda)
        {
            Formation Nda = Getfm(nda.FM_name);

            Nda.FM_name = nda.FM_name;
            Nda.FM_price = nda.FM_price;

            return LD.SaveChanges();
        }
    }
}